package config

import (
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"sigs.k8s.io/yaml"
)

type Config struct {
	App App `yaml:"app"`
	Byy Byy `yaml:"byy"`
}

type App struct {
	Port int `yaml:"port"`
}

type Byy struct {
	Namespace string `yaml:"namespace"`
	MockNode  bool   `yaml:"mock_node"`
}

var GlobalConfig Config

func init() {
	dir, err := os.Getwd()
	if err != nil {
		log.Fatal(err.Error())
	}
	y, err := ioutil.ReadFile(dir + "/config.yaml")
	yaml.Unmarshal(y, &GlobalConfig)
	fmt.Println(GlobalConfig)
}
